<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="UTF-8">
		<title>红酒会 - 智能红酒管家</title>
		<link rel="shortcut icon" type="image/x-icon" href="${ctx}/favicon.ico" />
		<link href="http://libs.baidu.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" href="${ctx}/static/libs/buttons/css/font-awesome.min.css" />
		<link rel="stylesheet" href="${ctx}/static/libs/buttons/css/buttons.css" />
		<link rel="stylesheet" href="${ctx}/static/styles/admin.css" />
	</head>
<body>
	<c:import url="admin_header.jsp" />

	<div class="container-fluid" style="padding-top:40px;">
		<div class="row-fluid">
			<div class="span2">
				<c:import url="admin_menu.jsp">
					<c:param name="menu">article_list</c:param>
				</c:import>
        	</div><!--/span-->
			<div class="span10">
				<div>
					<ul class="breadcrumb">
	  					<li><a href="${ctx}/admin/article/list">文章管理</a> <span class="divider">/</span></li>
	  					<li class="active">文章列表</li>
					</ul>
				</div>
				<div>
					<form action="${ctx}/admin/article/list" method="post" class="form-horizontal">
						<a href="${ctx}/admin/article/create" class="btn btn-info"><i class="icon-file"></i>&nbsp;新建</a>&nbsp;&nbsp;
	  					<div class="input-prepend">
	  						<span class="add-on">文章标题</span>
	    					<input type="text" name="title" class="input-large" value="${article.title}">
	  					</div>
	  					<button type="submit" class="btn"><i class="icon-search"></i>&nbsp;&nbsp;查询</button>
					</form>
					
					<table class="table table-bordered table-condensed">
						<thead>
							<tr>
								<th width="40%">文章标题</th>
								<th width="15%">是否推荐</th>
								<th width="15%">创建人</th>
								<th width="15%">创建时间</th>
								<td width="15%">操作</td>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="list" items="${list}">
								<tr>
									<td>
										<a href="${ctx}/admin/article/detail/${list.id}">${list.title}</a>
									</td>
									<td>
										<c:choose>
											<c:when test="${list.recommend==0}"><span class="label label-important">否</span></c:when>
											<c:otherwise><span class="label label-success">是</span></c:otherwise>
										</c:choose>
									</td>
									<td>${list.creatorName}</td>
									<td><fmt:formatDate value="${list.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
									<td>
										<c:choose>
											<c:when test="${list.recommend==0}">
												<a href="${ctx}/admin/article/update?id=${list.id}&recommend=1">推荐</a>
											</c:when>
											<c:otherwise>
												<a href="${ctx}/admin/article/update?id=${list.id}&recommend=0">取消推荐</a>
											</c:otherwise>
										</c:choose>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</body>
</html>